<template>
    <div class="box">
        <div class="title">
            <p>男女比例</p>
            <img src="@/assets/screen/dataScreen-title.png" alt="">
        </div>
        <div class="sex">
            <div class="man">
                <img src="@/assets/screen/man.png" alt="">
            </div>
            <div class="woman">
                <img src="@/assets/screen/woman.png" alt="">
            </div>
        </div>
        <div class="rate">
            <p>男士58%</p>
            <p>女士42%</p>
        </div>
        <div class="charts" ref="chart"></div>
    </div>
</template>

<script setup lang='ts'>
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'

const chart = ref()

onMounted(() => {
    const mycharts = echarts.init(chart.value)
    mycharts.setOption({
        title:{
            text:'男女比例',
            left:'40%',
            textStyle:{
                color:'skyblue'
            }
        },
        series:[{
            type:"bar",
            data:[58],
            barWidth:20,
            z:100,
            itemStyle:{
                borderRadius:20,
                color:'#007afe'
            }
        },
        {
            type:"bar",
            data:[100],
            barWidth:20,
            barGap:'-100%',
            itemStyle:{
                borderRadius:20,
                color:'#ff4b7a'
            }
        }],
        xAxis:{
            show:false,
        },
        yAxis:{
            type:'category',
            show:false,
        },
        grid:{
            left:0,
            right:0,
            top:0,
            bottom:0
        }
    })
})
</script>

<style scoped lang="scss">
.box {
    width: 100%;
    height: 100%;
    background: url(@/assets/screen/dataScreen-main-cb.png) no-repeat;
    background-size: 100% 100%;
    margin-top: 20px;

    .title {
        p {
            color: white;
            font-size: 20px
        }
    }

    .sex {
        display: flex;
        justify-content: center;

        .man {
            margin: 30px;
            width: 111px;
            height: 115px;
            background: url(@/assets/screen/man-bg.png);
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .woman {
            margin: 30px;
            width: 110px;
            height: 115px;
            background: url(@/assets/screen/woman-bg.png);
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }

    .rate{
        display: flex;
        color: white;
        justify-content: space-around;
    }
    .charts{
        width: 80%;
        margin-top: 10px;
        height: 80px;
        margin: 0 auto;
    }
}
</style>